import sys

from PyQt4 import QtGui, QtCore, QtWebKit

from editor import Editor
from ui import MainWindow
from ui import FileMenu
from ui import ViewMenu
from ui import EditMenu

import config

class Ventana(QtGui.QMainWindow):

    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.setWindowTitle('Mango IDE - Preview Activated')
        self.setWindowState(QtCore.Qt.WindowMaximized)
        self.setWindowIcon(QtGui.QIcon(config.img['logo']))

        #Main Widgets
        self.main = MainWindow(self)
        self.setCentralWidget(self.main)

        #Menu
        menubar = self.menuBar()
        file = menubar.addMenu('&File')
        edit = menubar.addMenu('&Edit')
        view = menubar.addMenu('&View')

        self._toolbar = self.addToolBar("toolbar")
        self._toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)

        self._fileMenu = FileMenu(file, self._toolbar, self.main)
        self._editMenu = EditMenu(edit, self._toolbar, self.main)
        self._viewMenu = ViewMenu(view, self._toolbar, self.main)

        self.main.obtain_editor().setFocus()


app = QtGui.QApplication(sys.argv)
p = Ventana()
p.show()
sys.exit(app.exec_())
